from django.core.files.storage import Storage

from aijia import settings


class QiuniuStorage(Storage):
    """自定义文件存储系统，修改存储的方案"""
    def __init__(self):
        pass

    def _open(self, name, mode='rb'):
        pass

    def _save(self, name, content):
        pass

    def url(self, name):
        """
        返回name所指文件的绝对URL
        :param name: 要读取文件的引用:group1/M00/00/00/wKhnnlxw_gmAcoWmAAEXU5wmjPs35.jpeg
        :return: http://qk2tzbru8.hn-bkt.clouddn.com/group1/M00/00/00/wKhnnlxw_gmAcoWmAAEXU5wmjPs35.jpeg
        """
        # return 'http://qk2tzbru8.hn-bkt.clouddn.com' + name
        return settings.QN_BASE_URL + name